<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
				xmlns:ui="http://java.sun.com/jsf/facelets"
				xmlns:h="http://java.sun.com/jsf/html"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:f="http://java.sun.com/jsf/core"
				xmlns:t="http://myfaces.apache.org/tomahawk"
				template="/pages/search_template.xhtml"> 

	<ui:param name="crudBean" value="#{downloadBean}" />
	
	<ui:define name="saveStateObjectsDefined">
		<t:saveState value="#{crudBean.listaSituacao}" />
		<t:saveState value="#{crudBean.listaTipoArquivo}" />
	</ui:define>
	
	<ui:define name="requiredFieldsMessage">
		<h:outputText value="#{bundle.todosCamposObrigatorios}" rendered="#{crudBean.searching}"/>
	</ui:define>
	
	<ui:define name="content">
		<!-- Painel de Pesquisa - Inicio -->
		<h:panelGroup id="panelGroupDePesquisa" rendered="#{crudBean.searching}">
			<f:subview id="viewBusca">
				<table>
					<tr>
						<td class="tdCor"><h:outputText value="#{bundle.lbl_periodo_geracao}"/> *</td>
						<td class="tdBranco">
							<rich:calendar value="#{crudBean.searchObject.filtro.dataGeracaoInicial}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
							<h:outputText value=" #{bundle.lbl_ate} "/>
							<rich:calendar value="#{crudBean.searchObject.filtro.dataGeracaoFinal}" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width:200px" showWeeksBar="false" inputSize="10" converter="dataConverter" oninputkeypress="formataData(this, event);" maxlength="10" onkeypress="soNumero(this);" enableManualInput="true"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor"><h:outputText value="#{bundle.lbl_nome_arquivo}"/> </td>
						<td class="tdBranco">
							<h:inputText value="#{crudBean.searchObject.nomeArquivo}" size="40" maxlength="50" onkeyup="return maiuscula3(this)"/>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="20%"><h:outputText value="#{bundle.lbl_situacao}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.situacao}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.valorCampo}" itemLabel="#{o.nomeValor}" value="#{crudBean.listaSituacao}" />
    						</h:selectOneMenu>
						</td>
					</tr>
					<tr>
						<td class="tdCor" width="20%"><h:outputText value="#{bundle.lbl_tipo_arquivo}"/></td>
						<td class="tdBranco">
							<h:selectOneMenu value="#{crudBean.searchObject.tipoArquivo}" converter="simpleIndexConverter">
    							<t:selectItems var="o" itemValue="#{o.valorCampo}" itemLabel="#{o.nomeValor}" value="#{crudBean.listaTipoArquivo}" />
    						</h:selectOneMenu>
						</td>
					</tr>
				</table>
			</f:subview>
		</h:panelGroup>
		<!-- Painel de Pesquisa - Fim -->

		
	</ui:define>
	
	<ui:define name="list">
		<h:panelGroup id="panelGroupDeListagem" rendered="#{crudBean.searching}">
			<f:subview id="viewListagem">
				<rich:dataTable id="tblData" value="#{crudBean.searchResult}" binding="#{crudBean.tblData}" var="rst" style="width: 100%;" rowClasses="par,impar">
					<f:facet name="header">
						<rich:columnGroup>
							<rich:column style="text-align: center;">
								<h:outputText value="#{bundle.lbl_data_geracao}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_nome_arquivo}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_tipo_arquivo}" />
							</rich:column>
							<rich:column style="text-align: right;">
								<h:outputText value="#{bundle.lbl_quantidade_registros}" />
							</rich:column>
							<rich:column style="text-align: left;">
								<h:outputText value="#{bundle.lbl_situacao}" />
							</rich:column>
							<rich:column style="text-align: rigth;">
							</rich:column>
						</rich:columnGroup>
					</f:facet>
					
					<rich:column style="text-align: center;">
						<h:outputText value="#{rst.dataGeracao}"/>
					</rich:column>
					<rich:column style="text-align: left;">
						<h:outputText value="#{rst.nomeArquivo}"/>
					</rich:column>
					<rich:column style="text-align: left;">
						<h:outputText value="#{rst.descricaoTipoArquivo}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:outputText value="#{rst.quantidadeRegistros}"/>
					</rich:column>
					<rich:column style="text-align: left;">
						<h:outputText value="#{rst.descricaoSituacao}"/>
					</rich:column>
					<rich:column style="text-align: right;">
						<h:commandLink actionListener="#{crudBean.download}">
							<h:graphicImage value="/imagens/baixar.gif" height="20" width="20" style="border: 0px;"/>
						</h:commandLink>
					</rich:column>
				</rich:dataTable>
			</f:subview>
		</h:panelGroup>
		
	</ui:define>

</ui:composition>